package com.tyd.cams.ui.news;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.google.android.material.tabs.TabLayout;
import com.tyd.cams.Adapter.ZiXunViewPagerAdapter;
import com.tyd.cams.R;
import com.tyd.cams.zixunfragment.JiaoWuFragment;
import com.tyd.cams.zixunfragment.SchoolGongFragment;
import com.tyd.cams.zixunfragment.SchoolZiXunFragment;

public class DashboardFragment extends Fragment {
    TabLayout tabLayout;
    ViewPager viewPager;
    ZiXunViewPagerAdapter ziXunViewPagerAdapter;

    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View root = inflater.inflate(R.layout.fragment_dashboard, container, false);
        tabLayout = root.findViewById(R.id.ZXtabLayout);
        viewPager = root.findViewById(R.id.ZXview_pager);
        ziXunViewPagerAdapter = new ZiXunViewPagerAdapter(getChildFragmentManager());
        ziXunViewPagerAdapter.add(new JiaoWuFragment(), "教学资讯");
        ziXunViewPagerAdapter.add(new SchoolGongFragment(), "通知公告");
        ziXunViewPagerAdapter.add(new SchoolZiXunFragment(), "沈科新闻");
        viewPager.setAdapter(ziXunViewPagerAdapter);
        tabLayout.setupWithViewPager(viewPager);
        return root;
    }
}